<html>
<head>
	<title>word预览</title>
</head>
<body>
	<img src="" id="yulan2"/>
	<input type="file" id="file0" name="wordfile" />
</body>
</html>
<script type="text/javascript" src="../IM/exp/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../IM/exp/ajaxfileupload.js"></script>
<script type="text/javascript">
	/* 案例展示图片预览 */
$(function(){
    $("#file0").bind("change",function(){

        clickupLoad();
    });
});
function clickupLoad(){

    var imgObject = document.getElementById('file0');
    var getImageSrc = getFullPath(imgObject);  // 本地路径
    var srcs  = window.URL.createObjectURL(imgObject.files[0]);
    var pos = getImageSrc.lastIndexOf(".");
    var lastname = getImageSrc.substring(pos, getImageSrc.length) // 图片后缀]
    console.log(lastname);
    if(srcs!=""){
        $("#yulan2").attr("src",srcs);
    }else{
        alert("请选择一张图片");
    }
    
}
function getFullPath(obj) {    //得到图片的完整路径
    if (obj)
    {
        if (window.navigator.userAgent.indexOf("MSIE") >= 1){
            obj.select();
            return document.selection.createRange().text;
        
        }else if(window.navigator.userAgent.indexOf("Firefox") >= 1) {
            if (obj.files) {
                return window.URL.createObjectURL(obj.files[0]);
            }
            return obj.value;
        }
        return obj.value;
    }
}
</script>